<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="stylesheet" href="../../css/style.css">
    <title>评价管理</title>
    <style>

      .table-bordered thead tr th {
           font-weight: normal;
           color: #999;
           border-left-color: #ffffff;
           border-right-color: #ffffff;
       }
       .table-bordered thead tr th:nth-of-type(2){
           text-align: right;

       }
       .table-bordered tbody tr th, .table-bordered tbody tr td{
           color: #999999;
           font-weight: normal;
            margin-right: 50px;
            border-left-color: #ffffff;
           border-right-color: #ffffff;
       }
        .table-bordered tbody tr th{
            background-color: #fafafa;
        }

       .table-bordered tbody tr td button{
           border: none;
           background:none;
           float: right;
       }

		.strs li{display: inline-block;}
        .goodsName a{color: #f00;}
        .goodsName {display:inline-block;width:300px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap; margin-right: 200px;}
        .goodsEvaluate{display:inline-block;width:200px;margin-right: 200px;}
        .goodsEvaluate ul{padding: 10px; display: inline-block;}
        .modal-body{width: 400px !important;margin: 0 auto;}
        textarea{vertical-align: top;}
        .btn-success{background-color: #3fb618 !important;border-color: #3fb618 !important;text-align: center;}
        .modal-title{float: left;}
        input{margin-left: 10px;}

    </style>
</head>
<body>
    <div class="configNav"></div>

    <!-- content -->
    <div class="container-fluid">
        <div class="row">
            <!-- left -->
            <div class="col-md-2">
                <div class="list-group">
                    <a href="order_index.html" class="list-group-item ">交易订单</a>
                    <a href="deliver_index.html" class="list-group-item ">发货</a>
                    <a href="address.html" class="list-group-item ">发货设置</a>
                    <a href="evaluate_admin.html" class="list-group-item active">评价管理</a>
                </div>
            </div>
            <!-- right -->
            <div class="col-md-10">
                <ol class="breadcrumb">
                    <li><a href="">商家管理中心</a></li>
                    <li><a href="">订单物流</a></li>
                    <li class="active"><a href="evaluate_admin.html">评价管理</a></li>
                </ol>
               <ul class="nav nav-tabs" >
                <li class="chose"><a href="evaluate_admin.html">来自买家的评论</a></li>

               </ul>
               <div class="form-inline">

                    <div class="form-group">
                        商品名称<input type="text" name="spName">
                    </div>
                    <div class="form-group">
                            评价人<input type="text" name="pjName">
                     </div>
                    <div>
                         <button style="width:70px;" class="search">搜索</button>
                     </div>
               </div>
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>评价信息</th>
                        <th >操作</th>
                    </tr>
                </thead>
                <tbody  id="tabaList">

                </tbody>
            </table>
                <nav aria-label="...">
                    <div class="">
                      <span id="pageNum">共&nbsp;<strong></strong>&nbsp;页&nbsp;/&nbsp;</span><span id="totalNum">&nbsp;<strong>0</strong>&nbsp;条数据</span>
                    </div>
                    <ul id="example"></ul>
                  </nav>
            </div>
        </div>
    </div>
    <script src="../../js/jquery.min.js" charset="utf-8"></script>
    <script src="../../js/bootstrap.min.js" charset="utf-8"></script>
    <script src="../../plugin/layer/layer.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js" charset="utf-8"></script>
    <script src="../../plugin/wangEditor/release/wangEditor.min.js" charset="utf-8"></script>
    <script src="../../js/nav.js" charset="utf-8"></script>
    <script src="../../js/common.js" charset="utf-8"></script>
    <script src="../../js/bootstrap-paginator.js" charset="utf-8"></script>
    <script src="../../js/ajax.js" charset="utf-8"></script>
    <!-- <script src="paging.js"></script>
    <script src="evalute.js"></script> -->
    <script>

		$(document).ready(function(){
		    tableList()
		})

		//search
		$(".search").click(function(){
		    var spName = $('[name="spName"]').val();
		    var pjName = $('[name="pjNmae"]').val();
		    var pageUrls =cncbk_common_tools.serverURL + '/business/goods/queryGoodsEvaluation',
		    //分页
		    data = {
		        'goodsName':spName,
		        'memberName':pjName,
		        'page': 1,
		        'pageSize': 10
		    }
		
		    ajax(
		        pageUrls,
		        data,
		        pageNumList,
		        'post',
		        'json'
		    )
		})


		function tableList(){
		    var pageUrls =cncbk_common_tools.serverURL + '/business/goods/queryGoodsEvaluation',
		    //分页
		    data = {
		        'goodsName':$('#goodsName').val(),
		        'memberName':$('#memberName').val(),
		        'page': page,
		        'pageSize': pagesize
		    }
		    data.page = 1
		    ajax(
		        pageUrls,
		        data,
		        pageNumList,
		        'post',
		        'json'
		    )
		}
		
		//调用
		// var data = {
		//     'areaParentId':''
		// }
		// var callback = function(res){
		//     var html = '';
		//     for (var i = 0; i < res.data.length; i++) {
		//         html += '<option value="'+ res.data[i].areaId +'">' + res.data[i].areaName + '</option>'
		//     }
		//     $('#memberProvinceid').append(html)
		//     $('#memberProvinceid').prepend('<option value="0">请选择省份</option>')
		//     $('#memberProvinceid').val('0')
		// }
		// ajax(
		//     ctServerURL,
		//     data,
		//     callback,
		//     'post',
		//     'json',
		// )
		
		//数据渲染
	function OpendList(res){
	    $('#tabaList').empty()
	    var html = '',scores='<li class="cs">&#9733;</li>';
	   
	    for (var i = 0; i < res.data.list.length; i++) {
	        html += '<tr>'+
	        '<th colspan="2">'+
	        '<ul>'+
	        '<li class="goodsName"><a href="http://47.92.118.122/html/wytx/goods_particulars.html?id='+res.data.list[i].goodsId +'" >'+ res.data.list[i].goodsName +'</a></li>'+
	        '<li class="goodsEvaluate">商品评价：'+
	        '<ul class="strs" >';
	        var scresLevel=res.data.list[i].scores;
	        if (scresLevel ==1) {
	        	 html +=scores;
	        }else if(scresLevel ==2){
	        	 html +=scores+ scores;
	        }else if (scresLevel ==3) {
	        	html +=scores+ scores+ scores;
	        }else if (scresLevel ==4) {
	        	html +=scores+ scores+ scores+ scores;
	        }else if (scresLevel ==5) {
	        	html +=scores+ scores+ scores+ scores+ scores;
	        }
	        html+='</ul>'+
	        '</li>'+
	        '<li class="memberName" style="display:inline-block;">评价人：<span >'+ res.data.list[i].memberName +'</span><time>['+ res.data.list[i].addTime+']</time></li>'+
	        '</ul>'+
	        '</th>'+
	        '</tr>'+
	        '<tr gevalId = '+res.data.list[i].gevalId+'>'+
	        '<td class="fl">评价内容：<span id="evaluateID">'+ res.data.list[i].content +'</span></td>'+
	        '<td class="fr"><button data-toggle="modal" data-target="#explain'+res.data.list[i].gevalId+'" id="onclickExplain'+res.data.list[i].gevalId+'"><span><i class="glyphicon glyphicon-comment"></i></span><br>'+ res.data.list[i].explain+'</button>'+
	        '<div class="modal fade" id="explain'+res.data.list[i].gevalId+'"  aria-labelledby="modalexplain" aria-hidden="true">'+
	            '<div class="modal-dialog">'+
	                '<div class="modal-conent">'+
	
	                    '<div class="modal-header">'+
	                        '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>'+
	                        '<h4 class="modal-title" id="modalexplain">解释评价:</h4>'+
	                    '</div>'+
	
	                    '<div class="modal-body">'+
	                        '<form role="form">'+
	
	                            '<div class="form-group">'+
	                            '<label for="contacts" > 评价内容：</label>'+
	                            '<span >'+res.data.list[i].content +'</span>'+
	                            '</div>'+
	                            '<div class="form-group" >'+
	                            '<label for="area" >解释内容：</label>'+
	                            '<textarea id="explainContent'+res.data.list[i].gevalId+'" cols="30" rows="10" ></textarea>'+
	                            '</div>'+
	
	                        '</form>'+
	                    '</div>'+
	
	                    '<div class="modal-footer">'+
	                    '<button type="button" class="btn btn-success explainsubmit" myId="'+res.data.list[i].gevalId+'" id="explainsubmit" >保存</button>'+
	                    '</div>'+
	                '</div>'+
	            '</div>'+
	        '</div>'
	        '</td>'+
	        '</tr>'
	    }
	    $('#tabaList').append(html);

	    //explain
	    $('.explainsubmit').off('click').click(function(){
	        var id = $(this).attr('myId');//id
	        var con = $('#explainContent'+id).val();
	
	        var pageUrls = cncbk_common_tools.serverURL + '/business/goods/explainGoodsEvaluation'
	        data = {
	            'id':id,
	            'explain':con,
	        }
	        var fun =function(result){
	            if(result.code==200){
	                $('#onclickExplain'+id).html('<span><i class="glyphicon glyphicon-comment"></i></span><br>'+con);
	                $('#explain'+id).modal('hide')
	            }else{
	                alert('操作失败！');
	            }
	        }
	        ajax(
	            pageUrls,
	            data,
	            fun,
	            'post',
	            'json'
	        )
	    })
	}
    </script>
</body>
</html>
